import { defineStore } from 'pinia';
interface pInfo{
    productId:Number,
    price:Number,
    quota:Number,
    isSelected:Number
}
export const useAddSeckillGoods = defineStore('addSeckillGoods', {
    state(){
        return {
            seckillImage:'',//商品主图
            seckillImages:[],//轮播图
            seckillTitle:'',//活动标题
            seckillInfo:'',//活动简介
            seckillTempId:'',//运费模板ID
            seckillNum:1,//当天参与活动次数
            seckillTime:[],//活动日期
            seckillTimeId:'',//时间段ID
            imgOblongUrl:'',
            seckillStatus:0,
            seckillProductId:'',//spu id
            productInfos:[] as Array<any>,
            seckillDescription:''
        }
    },
    actions:{
        removeItem() {
            const arr = this.productInfos.map(item => {
                return {
                    productId : Number(item.skuId),
                    price:Number(item.price),
                    quota:Number(item.quota),
                    isSelected:Number(item.isSelected)
                }
            })
            return arr;
        },
        resetAll() {
            this.$reset()
          },
      
    }
})